package io.renren.generator.controller;

import java.util.Arrays;
import java.util.Map;

import io.renren.common.utils.PageUtils;
import io.renren.generator.entity.EduUserExtendEntity;
import io.renren.generator.service.EduUserExtendService;
import io.renren.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * 用户信息扩展表
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2021-12-23 17:26:43
 */
@RestController
@RequestMapping("generator/eduuserextend")
public class EduUserExtendController {
    @Autowired
    private EduUserExtendService eduUserExtendService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params) {
        PageUtils page = eduUserExtendService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id) {
        EduUserExtendEntity eduUserExtend = eduUserExtendService.getById(id);

        return R.ok().put("eduUserExtend", eduUserExtend);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody EduUserExtendEntity eduUserExtend) {
        eduUserExtendService.save(eduUserExtend);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody EduUserExtendEntity eduUserExtend) {
        eduUserExtendService.updateById(eduUserExtend);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids) {
        eduUserExtendService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
